#ifndef _MID_I2C_MASTER_DRV_H_
#define _MID_I2C_MASTER_DRV_H_

#define U8_PIN_HIGH  (1)
#define U8_PIN_LOW   (0)

void HalMasterI2cDevInit(void);
unsigned char HalGetMasterI2cSlaveAckRsl(unsigned char u8Chn);
void HalMasterI2cSendMultiByte(unsigned char u8Chn, unsigned char u8Addr,unsigned char *pData,unsigned char u8Len);
void HalMasterI2cReadMultiByte(unsigned char u8Chn, unsigned char u8Addr, unsigned char *pData,unsigned char u8Len);
void HalEepromProc(void);
void HalClcMasterI2cSlaveAckFg(unsigned char u8Chn);
void HalMasterI2cStartBit(unsigned char u8Chn);
void HalI2cSlaveAck(unsigned char u8Chn);
void HalMasterI2cAck(unsigned char u8Chn);
void HalMasterI2cWrite8Bit(unsigned char u8Chn, unsigned char u8Data);
void HalMasterI2cStopBit(unsigned char u8Chn);
void HalMasterI2cRead8Bit(unsigned char u8Chn, unsigned char *p);


//******************IIC参数设置*****************//
#define U8_BIG_ENDIAN       (1)     ///<1：高位优先   0：低位优先
#define U8_HAL_I2C_NUM      (1)     //IIC设备数量
#define U8_DELAY_TIM        (30)    

enum
{
    U8_HAL_I2C_CH0 = 0,
    U8_HAL_I2C_CH1,
    ////如有多路IIC设备在此按需新增
};
//******************IIC参数设置*****************//


//**********************IIC引脚**********************//
#define SET_I2C_CH0_SDA_HIGH()     do{SET_P3_0; SET_P3_0_OUTPUT;}while(0)                   
#define CLR_I2C_CH0_SDA_LOW()      do{CLR_P3_0; SET_P3_0_OUTPUT;}while(0)
#define SET_I2C_CH0_SCL_HIGH()     do{SET_P3_1; SET_P3_1_OUTPUT;}while(0)                      
#define CLR_I2C_CH0_SCL_LOW()       do{CLR_P3_1; SET_P3_1_OUTPUT;}while(0)
#define SET_I2C_CH0_SDA_INPUT()     do{SET_P3_0_PODE;SET_P3_0_INPUT;}while(0)
#define SET_I2C_CH0_SDA_OUTPUT()     do{CLR_P3_0_PODE;SET_P3_0_OUTPUT;}while(0)
#define GET_I2C_CH0_SDA()          (GET_P3_0)
//**********************IIC引脚**********************//

#endif



